package com.leetcode.partition9;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayDeque;
import java.util.Queue;

public class LC838推多米诺 {

    private static final int N = 100010;
    private static Queue<int[]> q = new ArrayDeque<>(N);
    private static int[] time = new int[N];
    private static int n = 0;
    
    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        String dominoes = reader.readLine();
        writer.write(pushDominoes(dominoes));
        writer.flush();
    }
    
    public static String pushDominoes(String dominoes) {
        n = dominoes.length();
        char[] ans = dominoes.toCharArray();
        for (int i = 0; i < n; i++) {
            if (dominoes.charAt(i) != '.') {
                int dir = dominoes.charAt(i) == 'L' ? -1 : 1;
                //加入三元组 [位置, 时间, 受到力的方向]
                q.add(new int[]{i, 1, dir});
                time[i] = 1;
            }
        }
        while (!q.isEmpty()) {
            int[] cur = q.poll();
            int u = cur[0], t = cur[1], dir = cur[2];
            int next = u + dir;
            if (next < 0 || next >= n) continue;
            if (time[next] == 0) {
                //首次受力
                q.add(new int[]{next, t + 1, dir});
                time[next] = t + 1;
                ans[next] = dir == -1 ? 'L' : 'R';
            } else if (time[next] == t + 1) {
                //多个方向受力且是同一个时间点受的力
                ans[next] = '.';
            }
        }
        return String.valueOf(ans);
    }
}
